﻿using System;
using System.Collections.Generic;
using System.Text;
using BusinessFacade;
using PMS.Common;
using PMS.EntityQuery;
using System.Data;
using System.Data.SqlClient;

namespace EntityManage
{
    public class Other_MessageManageExt : IOther_MessageHandlerExt
    {
        DataBase db = new DataBase();

        public DataTable GetMyRecvMessage(int userId)
        {
            try
            {
                string SqlStr = @" SELECT msg.* FROM Other_Message msg inner join 
                    Other_MessageRecever recv ON msg.ID = recv.Message_ID
                    WHERE recv.User_ID = @User_ID
                    ORDER BY recv.Status asc, msg.ID desc";
                SqlParameter[] prams = new SqlParameter[1];
                prams[0] = new SqlParameter("@User_ID", userId);
                prams[0].Direction = System.Data.ParameterDirection.Input;

                return db.RunSqlTab(SqlStr, prams);
            }
            catch { }

            return null;
        }
    }
}
